1 00:00:00,330 --> 00:00:03,010 I have my zombie game opened back up. 2 00:00:03,030 --> 00:00:08,820 We had just finished off with a shot frame before I went to the MPC stuff, but I don't want this shot 3 00:00:08,820 --> 00:00:14,970 frame in the way when I'm working on things, so I'm going to click on it, go down to visible and uncheck 4 00:00:14,970 --> 00:00:15,330 it. 5 00:00:15,570 --> 00:00:16,530 There you go. 6 00:00:16,530 --> 00:00:19,200 It will still come on when we hit our little bell. 7 00:00:19,680 --> 00:00:20,070 All right. 8 00:00:20,070 --> 00:00:25,320 So I'm going to bring I'm going to bring Chuck Norris in right down here where the zombies are. 9 00:00:25,320 --> 00:00:30,660 And I put them in the resources so you can save them off. 10 00:00:30,660 --> 00:00:41,610 And then we're going to go right click, say, insert from file chuck complete, and we'll just pull 11 00:00:41,610 --> 00:00:42,990 them on into the game. 12 00:00:43,350 --> 00:00:49,260 Now, currently, Chuck is only going to chase after things that are one child down in the workspace. 13 00:00:49,260 --> 00:00:53,470 That's how we did our find closest character. 14 00:00:53,490 --> 00:00:54,780 Let's take a look inside. 15 00:00:54,780 --> 00:00:56,070 Chuck, Open them up. 16 00:00:56,070 --> 00:00:57,300 He's in the workspace. 17 00:00:57,300 --> 00:00:58,770 We're going to go to the move. 18 00:00:58,770 --> 00:01:00,250 NPC. 19 00:01:00,250 --> 00:01:06,600 We're going to change the method of which he goes through The people who are who is is who is his enemy 20 00:01:06,600 --> 00:01:07,920 or not his enemy. 21 00:01:07,920 --> 00:01:12,510 And I'm going to add something called the collection service. 22 00:01:12,510 --> 00:01:16,950 I'm just going to call it CS and I'm going to tag his enemies. 23 00:01:16,950 --> 00:01:23,210 So do game get service, collection service. 24 00:01:23,220 --> 00:01:27,990 Let's go down to where he finds the nearest char. 25 00:01:28,020 --> 00:01:32,910 Now, here, if the character is in the workspace and they have a humanoid root party, he's going to 26 00:01:32,910 --> 00:01:34,020 chase after them. 27 00:01:34,020 --> 00:01:40,500 But as you may remember, our zombies that were spawning, we're spawning in a folder that's two levels 28 00:01:40,500 --> 00:01:41,130 down. 29 00:01:41,130 --> 00:01:46,080 And I don't want to do a get descendants, which will go all the way down into the folders. 30 00:01:46,080 --> 00:01:47,580 It'll just take too long. 31 00:01:47,670 --> 00:01:52,800 What we need to do is have him look for the things that are tagged as an enemy. 32 00:01:53,580 --> 00:02:00,630 I will show you how to tag enemies shortly, but let's write our code to find the tag enemies right 33 00:02:00,630 --> 00:02:00,960 now. 34 00:02:00,960 --> 00:02:02,430 Because we're right here. 35 00:02:02,430 --> 00:02:02,880 Right? 36 00:02:02,880 --> 00:02:07,410 So assume that we've attacked, we've tagged some enemies, which we'll do real quick. 37 00:02:08,730 --> 00:02:12,900 And we're going to make a table called Targets. 38 00:02:13,290 --> 00:02:18,400 We're going to use the collection service to get tagged. 39 00:02:18,420 --> 00:02:21,090 Now, notice there's a get tags, right? 40 00:02:21,090 --> 00:02:22,770 We won't get tagged. 41 00:02:22,770 --> 00:02:27,180 Get tags, gets the tags off of the things that you have tagged. 42 00:02:27,180 --> 00:02:28,890 Get tagged. 43 00:02:29,670 --> 00:02:35,100 We're going to send in the name of the tag chop target. 44 00:02:35,100 --> 00:02:36,540 That's what we're going to call it. 45 00:02:36,690 --> 00:02:42,450 And then we're going to get a table with all of the things that were tagged as Chuck Target, which 46 00:02:42,450 --> 00:02:44,790 are which is none right now, but we're going to change it. 47 00:02:44,790 --> 00:02:45,480 Don't worry. 48 00:02:45,750 --> 00:02:52,740 I'm going to go right here under this workspace where we get the children and then I'm just going to 49 00:02:52,740 --> 00:02:54,520 search through the targets. 50 00:02:54,540 --> 00:03:00,690 Now we have to assume that the targets are going to be characters, because on the first level, right. 51 00:03:00,690 --> 00:03:01,020 Fine. 52 00:03:01,020 --> 00:03:03,120 First child, we're going to look for a humanoid. 53 00:03:03,120 --> 00:03:04,920 So you've got to keep that in mind. 54 00:03:04,920 --> 00:03:07,890 If they're players, you're going to have to tag their char. 55 00:03:07,890 --> 00:03:08,460 Don't worry. 56 00:03:08,460 --> 00:03:10,110 I'm going to show you how to do that. 57 00:03:11,900 --> 00:03:15,370 Now let's tag our enemies, starting with the easiest method. 58 00:03:15,380 --> 00:03:17,190 So I'm going to go to the game world. 59 00:03:17,210 --> 00:03:18,180 Here's Chuck. 60 00:03:18,200 --> 00:03:21,980 I'm going to grab these zombies right there, way over there. 61 00:03:22,010 --> 00:03:22,640 Just grab them. 62 00:03:22,640 --> 00:03:25,070 Pull them over so we're not spawning. 63 00:03:25,400 --> 00:03:27,410 They're just sitting in the work place. 64 00:03:27,710 --> 00:03:30,600 Let's grab the tag editor. 65 00:03:30,620 --> 00:03:32,150 I'm up here in the banner. 66 00:03:32,150 --> 00:03:33,710 I'm going to right click. 67 00:03:34,220 --> 00:03:36,680 And then I look for tag editor. 68 00:03:36,680 --> 00:03:38,360 Here it is, way down the bottom. 69 00:03:38,840 --> 00:03:41,300 All right, so these tags are on the zombies. 70 00:03:41,330 --> 00:03:43,300 The tag editor is for all the tags. 71 00:03:43,310 --> 00:03:45,050 We're going to create a new tag, though. 72 00:03:45,050 --> 00:03:46,430 We're going to create it for Chuck. 73 00:03:47,180 --> 00:03:48,540 And we'll call it Chuck. 74 00:03:48,560 --> 00:03:49,280 Target. 75 00:03:50,300 --> 00:03:51,290 Chuck. 76 00:03:52,400 --> 00:03:53,450 Target. 77 00:03:53,810 --> 00:03:54,460 There it is. 78 00:03:54,470 --> 00:04:01,190 So whatever you select, like, I have this drooling zombie selected and you check it, you tagged it. 79 00:04:01,400 --> 00:04:03,620 All right, now let's select the other zombie. 80 00:04:03,890 --> 00:04:04,600 Boom. 81 00:04:04,610 --> 00:04:07,230 If you want to check to see if it's tagged, just select it. 82 00:04:07,250 --> 00:04:07,880 There we go. 83 00:04:07,880 --> 00:04:09,870 Like my landmine sign. 84 00:04:09,890 --> 00:04:11,510 Nope, not tagged. 85 00:04:11,510 --> 00:04:12,230 Zombie. 86 00:04:12,230 --> 00:04:12,690 Yup. 87 00:04:12,710 --> 00:04:13,610 Tagged. 88 00:04:13,790 --> 00:04:14,660 Nice. 89 00:04:14,690 --> 00:04:21,160 Now, let's go ahead and play this and see what happens when Chuck finds his tagged zombies. 90 00:04:21,170 --> 00:04:21,800 You know what? 91 00:04:21,800 --> 00:04:27,170 I'm going to do a print out right here for my targets. 92 00:04:27,290 --> 00:04:33,740 I'm going to do a print targets equal, and I'll do targets. 93 00:04:34,220 --> 00:04:35,840 And that'll print them out, too. 94 00:04:36,200 --> 00:04:40,490 Let's go to view output window so we can see what's going on. 95 00:04:40,490 --> 00:04:42,260 I'm going to go to my zombie game. 96 00:04:42,260 --> 00:04:45,320 Yeah, I want to start from here so I could see it. 97 00:04:45,770 --> 00:04:46,820 Let's hope it starts up. 98 00:04:46,820 --> 00:04:47,170 Okay. 99 00:04:47,180 --> 00:04:48,650 We just got an update. 100 00:04:50,500 --> 00:04:51,440 Looks good. 101 00:04:51,890 --> 00:04:52,820 Yeah. 102 00:04:52,850 --> 00:04:56,150 Chuck kicked them all, but he died on that zombie. 103 00:04:56,150 --> 00:04:59,030 We're going to have to crank up his power a little bit, but that's all right. 104 00:04:59,030 --> 00:05:00,080 We got the tags. 105 00:05:00,080 --> 00:05:01,010 We can open it up. 106 00:05:01,010 --> 00:05:03,490 We look, we have the two drooling zombies. 107 00:05:03,500 --> 00:05:08,270 Now let's add tags to the zombies that are being spawned.